﻿package  
{
	import flash.display.Sprite;
	
	import idv.etrex.events.PlayerEvent;
	import idv.etrex.display.object.DynamicMask;
	import idv.etrex.display.XGraphics;
	import idv.etrex.compression.XGraphicsDownsampler;
	
	/**
	 * ...
	 * @author etrex
	 */
	public class DynamicMaskToolTest extends Sprite
	{
		var dm:DynamicMask = new DynamicMask();

		public function DynamicMaskToolTest() 
		{	
			trace("DynamicMaskToolTest");

			dm.x = 0;
			dm.y = 0;
			dm.playingRate = 3;
			this.addChild(dm);
			
			dm.addEventListener(PlayerEvent.READY, dmReady);
			//dm.addEventListener(PlayerEvent.COMPLETE, dmComplete);
			
			//dm.loadFromFile("2008321221516105_2.jpg", "test.xg");			
			dm.loadFromFile("1119.png", "1119.xg");
			
			
			//dm.onReady = dm.play;
			//dm.onComplete = dm.replay;
			//dm.loadFromFile("New kaleidoscope.png", "New kaleidoscope.xg");
		}

		private function dmReady(e:PlayerEvent):void {
			//var xgds:XGraphicsDownsampler = new XGraphicsDownsampler(dm.xgraphics);
			//dm.xgraphics = xgds.downSample(10);
			dm.play();
		}
		//private function dmComplete(e:PlayerEvent):void {
			//dm.replay();
		//}
	}

}